﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace WpfStarterKit.Framework.Commands
{
    /// <summary>
    /// This command class is used to disable commands on screen. Set an instance of this command class as value of a command
    /// you want to disable.
    /// </summary>
    public class DisableCommand : ICommand
    {
        #region ICommand Members

        /// <summary>
        /// Whether the command can execute
        /// </summary>
        /// <param name="parameter">Input parameters</param>
        /// <returns>Always returns false</returns>
        public bool CanExecute(object parameter)
        {
            return false;
        }

        /// <summary>
        /// Triggered when the value of CanExecute changes
        /// </summary>
        public event EventHandler CanExecuteChanged
        {
            add { CommandManager.RequerySuggested += value; }
            remove { CommandManager.RequerySuggested -= value; }
        }

        /// <summary>
        /// Throws a NotImplementedException. This method should never be called because th CanExecute of this command class
        /// always returns false.
        /// </summary>
        /// <param name="parameter"></param>
        public void Execute(object parameter)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
